﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SpaceFight
{
    class SpaceShip : BasicModel
    {
        Matrix rotation = Matrix.Identity;
        float yawAngle = 0;
        float pitchAngle = 0;
        float rollAngle = 0;
        Vector3 direction;

        public SpaceShip(Model model, float yawAngle, float pitchAngle, float rollAngle, Vector3 position, Vector3 direction)
            :base(model)
        {
            world = Matrix.CreateScale(1f) * Matrix.CreateFromQuaternion(Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 0f)) * Matrix.CreateTranslation(position);
            this.yawAngle = yawAngle;
            this.pitchAngle = pitchAngle;
            this.rollAngle = rollAngle;
            this.direction = direction;
        }

        public override void Update()
        {
            rotation *= Matrix.CreateFromYawPitchRoll(yawAngle, pitchAngle, rollAngle);

            world *= Matrix.CreateTranslation(direction);
           
            base.Update();
        }


    }
}
